const router = require('koa-router')()
const Users = require('../controllers/users')


// 用户模块
router.prefix('/users')
router.post('/', Users.create)
router.post('/:id', Users.update)
router.get('/', Users.list)
router.get('/:id', Users.get)


/*router.get('/', async (ctx, next) => {
    await ctx.render('index', {
        title: 'Hello Koa 2!'
    })
})

router.get('/string', async (ctx, next) => {
    ctx.body = 'koa2 string'
})

router.get('/json', async (ctx, next) => {
    ctx.body = {
        title: 'koa2 json'
    }
})*/

module.exports = router
